# shared-mime-info
# Builds from https://github.com/puppylinux-woof-CE/petbuilds
# File auto generated by ./mk_petbuild.sh. Edit as necessary.

. ../../func
. ../../build.conf

URL=http://freedesktop.org/~hadess
PKG=shared-mime-info
VER=1.9
COMP=tar.xz
DESC="mimetype information"
DEPS=
CAT=BuildingBlock
DESKTOP=shared-mime-info.desktop
BUILD=2
CWD=$(pwd)
[ -z "$BUILD" ] && BUILD=$DEF_BUILD
# comment these 2 below if you use a custom package() function
[ -f "$DESKTOP" ] || DESKTOP=not
[ -z "$DEPS" ] && DEPS=not

ARCH=$(uname -m)
case $ARCH in # set in build.conf
 *64) 	LIBDIR=$LIBCONF64 ;;
 arm*)	LIBDIR=$LIBCONFarm;;
 *) 	LIBDIR=$LIBCONF32 ;;
esac

build() {
	cd ${PKG}-${VER}
	patch freedesktop.org.xml.in ../magic_fix.patch
	./configure --prefix=/usr \
				--localstatedir=/var \
				--sysconfdir=/etc \
				--libdir=/usr/${LIBDIR}
	[ "$?" -eq 0 ] || exit
	make $MKFLG
	[ "$?" -eq 0 ] || exit
	#make DESTDIR=$CWD/${PKG}-install install
	sed -i '/xml:lang/d' freedesktop.org.xml
	install -d $CWD/${PKG}-install/usr/bin
	install -d $CWD/${PKG}-install/usr/share/mime/packages
	install -d $CWD/${PKG}-install/usr/${LIBDIR}/pkgconfig
	install -m 755 update-mime-database $CWD/${PKG}-install/usr/bin
	install -m 644 freedesktop.org.xml $CWD/${PKG}-install/usr/share/mime/packages
	install -m 644 shared-mime-info.pc $CWD/${PKG}-install/usr/${LIBDIR}/pkgconfig
	cd -
}

# main
retrieve ${PKG}-${VER}.${COMP}
extract ${PKG}-${VER}.${COMP}
build
package_std $PKG $VER $ARCH $DESKTOP "$DESC" $DEPS $CAT
